function imOut = impad(imIn, b)
% en utilisant la fonction padarray de matlab
% imOut = padarray(imIn,[b b]);

% sans utiliser la fonction padarray
[rows, cols, dim] = size(imIn);
z = zeros(rows+2*b, cols+2*b, dim);

% get the padding rows
padr = z(:,1:b, :);

% append 'rows+2*b' of 'zeros' the imIn
imIn(rows+2*b, :) = 0;

% cirshift (down) imIn by b cells
imOut = [padr, circshift(imIn, b), padr ];